using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
namespace Ascent.QiPei.Module.BusinessObjects.Purchase
{
  [DefaultClassOptions]
  [DevExpress.Persistent.Base.NavigationItemAttribute("采购管理")]
  [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("采购订单")]
  public partial class PurchasingOrder : DevExpress.Persistent.BaseImpl.BaseObject
  {
    private System.Single _hasPaymentAmount;
    private System.Single _gargoServiceCharge;
    private System.Single _gargoFare;
    private Ascent.QiPei.Module.BusinessObjects.Base.GargoTeminal _gargoTeminal;
    private System.String _receivedCollection;
    private System.Single _receivedUnpaid;
    private System.Single _receivedRemitCash;
    private System.Single _receivedCash;
    private Ascent.QiPei.Module.BusinessObjects.Enums.OrderStatusType _pOStatus;
    private System.Int16 _taxRate;
    private System.Int16 _discount;
    private System.Boolean _taxIncluded;
    private System.Single _totalAmount;
    private System.Single _taxAmount;
    private System.Single _amount;
    private System.Single _discountAmount;
    private System.String _remarks;
    private Ascent.QiPei.Module.BusinessObjects.Base.ShipVia _shipVia;
    private System.String _invoiceNumber;
    private System.DateTime _requiredDeliveryDate;
    private Ascent.QiPei.Module.BusinessObjects.Base.Employee _purchasePerson;
    private Ascent.QiPei.Module.BusinessObjects.Base.Supplier _supplier;
    private System.String _pOCode;
    public PurchasingOrder(DevExpress.Xpo.Session session)
      : base(session)
    {
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("采购单")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    public System.String POCode
    {
      get
      {
        return _pOCode;
      }
      set
      {
        SetPropertyValue("POCode", ref _pOCode, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("供应商")]
    public Ascent.QiPei.Module.BusinessObjects.Base.Supplier Supplier
    {
      get
      {
        return _supplier;
      }
      set
      {
        SetPropertyValue("Supplier", ref _supplier, value);
        //if (_supplier == value)
        //    return;
        //Ascent.QiPei.Module.BusinessObjects.Base.Supplier prevSupplier = _supplier;
        //_supplier = value;
        //if (IsLoading)
        //    return;
        //if (prevSupplier != null && prevSupplier.PurchasingOrder == this)
        //    prevSupplier.PurchasingOrder = null;
        //if (_supplier != null)
        //    _supplier.PurchasingOrder = this;
        //OnChanged("Supplier");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("采购员")]
    public Ascent.QiPei.Module.BusinessObjects.Base.Employee PurchasePerson
    {
      get
      {
        return _purchasePerson;
      }
      set
      {
        SetPropertyValue("PurchasePerson", ref _purchasePerson, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("交货日期")]
    public System.DateTime RequiredDeliveryDate
    {
      get
      {
        return _requiredDeliveryDate;
      }
      set
      {
        SetPropertyValue("RequiredDeliveryDate", ref _requiredDeliveryDate, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("折扣%")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public System.Int16 Discount
    {
      get
      {
        return _discount;
      }
      set
      {
        SetPropertyValue("Discount", ref _discount, value);
      }
    }
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("是否含税")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public System.Boolean TaxIncluded
    {
      get
      {
        return _taxIncluded;
      }
      set
      {
        SetPropertyValue("TaxIncluded", ref _taxIncluded, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("发票号码")]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    public System.String InvoiceNumber
    {
      get
      {
        return _invoiceNumber;
      }
      set
      {
        SetPropertyValue("InvoiceNumber", ref _invoiceNumber, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("运输方式")]
    public Ascent.QiPei.Module.BusinessObjects.Base.ShipVia ShipVia
    {
      get
      {
        return _shipVia;
      }
      set
      {
        if (_shipVia == value)
          return;
        Ascent.QiPei.Module.BusinessObjects.Base.ShipVia prevShipVia = _shipVia;
        _shipVia = value;
        if (IsLoading)
          return;
        if (prevShipVia != null && prevShipVia.PurchasingOrder == this)
          prevShipVia.PurchasingOrder = null;
        if (_shipVia != null)
          _shipVia.PurchasingOrder = this;
        OnChanged("ShipVia");
      }
    }
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("税率")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public System.Int16 TaxRate
    {
      get
      {
        return _taxRate;
      }
      set
      {
        SetPropertyValue("TaxRate", ref _taxRate, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("备注")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public System.String Remarks
    {
      get
      {
        return _remarks;
      }
      set
      {
        SetPropertyValue("Remarks", ref _remarks, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("合计金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single TotalAmount
    {
      get
      {
        return _totalAmount;
      }
      set
      {
        SetPropertyValue("TotalAmount", ref _totalAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("折扣金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single DiscountAmount
    {
      get
      {
        return _discountAmount;
      }
      set
      {
        SetPropertyValue("DiscountAmount", ref _discountAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("税金金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single TaxAmount
    {
      get
      {
        return _taxAmount;
      }
      set
      {
        SetPropertyValue("TaxAmount", ref _taxAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("应收金额 ")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single Amount
    {
      get
      {
        return _amount;
      }
      set
      {
        SetPropertyValue("Amount", ref _amount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("现金")]
    public System.Single ReceivedCash
    {
      get
      {
        return _receivedCash;
      }
      set
      {
        SetPropertyValue("ReceivedCash", ref _receivedCash, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("汇款")]
    public System.Single ReceivedRemitCash
    {
      get
      {
        return _receivedRemitCash;
      }
      set
      {
        SetPropertyValue("ReceivedRemitCash", ref _receivedRemitCash, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("挂帐")]
    public System.Single ReceivedUnpaid
    {
      get
      {
        return _receivedUnpaid;
      }
      set
      {
        SetPropertyValue("ReceivedUnpaid", ref _receivedUnpaid, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("代收")]
    public System.String ReceivedCollection
    {
      get
      {
        return _receivedCollection;
      }
      set
      {
        SetPropertyValue("ReceivedCollection", ref _receivedCollection, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("运费")]
    public System.Single GargoFare
    {
      get
      {
        return _gargoFare;
      }
      set
      {
        SetPropertyValue("GargoFare", ref _gargoFare, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("手续费")]
    public System.Single GargoServiceCharge
    {
      get
      {
        return _gargoServiceCharge;
      }
      set
      {
        SetPropertyValue("GargoServiceCharge", ref _gargoServiceCharge, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("货运站")]
    public Ascent.QiPei.Module.BusinessObjects.Base.GargoTeminal GargoTeminal
    {
      get
      {
        return _gargoTeminal;
      }
      set
      {
        SetPropertyValue("GargoTeminal", ref _gargoTeminal, value);
        //if (_gargoTeminal == value)
        //  return;
        //Ascent.QiPei.Module.BusinessObjects.Base.GargoTeminal prevGargoTeminal = _gargoTeminal;
        //_gargoTeminal = value;
        //if (IsLoading)
        //  return;
        //if (prevGargoTeminal != null && prevGargoTeminal.PurchasingOrder == this)
        //  prevGargoTeminal.PurchasingOrder = null;
        //if (_gargoTeminal != null)
        //  _gargoTeminal.PurchasingOrder = this;
        //OnChanged("GargoTeminal");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("订单状态")]
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.QiPei.Module.BusinessObjects.Enums.OrderStatusType POStatus
    {
      get
      {
        return _pOStatus;
      }
      set
      {
        SetPropertyValue("POStatus", ref _pOStatus, value);
      }
    }
    [DevExpress.Xpo.AssociationAttribute("PurchasingOrderItems-PurchasingOrder")]
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("订单明细")]
    public XPCollection<Ascent.QiPei.Module.BusinessObjects.Purchase.PurchasingOrderItems> PurchasingOrderItems
    {
      get
      {
        return GetCollection<Ascent.QiPei.Module.BusinessObjects.Purchase.PurchasingOrderItems>("PurchasingOrderItems");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("应付帐已付金额")]
    [System.ComponentModel.BrowsableAttribute(false)]
    public System.Single HasPaymentAmount
    {
      get
      {
        return _hasPaymentAmount;
      }
      set
      {
        SetPropertyValue("HasPaymentAmount", ref _hasPaymentAmount, value);
      }
    }
  }
}
